#include "glory.h"

void disp(void *cls);
void reshape(int x, int y, void *cls);
void keyb(int key, int state, void *cls);

int main(void)
{
	glory_init();
	glory_create_window(800, 600, GLORY_DEPTH | GLORY_DOUBLE);

	glory_display_callback(disp, 0);
	glory_reshape_callback(reshape, 0);
	glory_keyboard_callback(keyb, 0);

	glClearColor(1, 0, 0, 1);

	glory_event_loop();
	return 0;
}

void disp(void *cls)
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glory_swap_buffers();
}

void reshape(int x, int y, void *cls)
{
	glViewport(0, 0, x, y);
}

void keyb(int key, int state, void *cls)
{
	switch(key) {
	case 27:
		glory_quit();
		break;
	}
}
